00001
00009 #include "ndame.h"
00010
00024 int menu(struct data*d1)
00025 {
00026 char chscan;
00027 int ii;
00028 int ik;
00029 int ichscan;
00030 int ic;
00031
00032 gotoxy(5,2);
00033 printf("<C>alculate");
00034 gotoxy(25,2);
00035 printf("<O>ptions");
00036 gotoxy(47,2);
00037 printf("<E>xit");
00038
00039 do
00040 {
00041 chscan=getch();
00042 }while(!((chscan=='c')||(chscan=='o')||(chscan=='e')));
00043
00044 ichscan=(int)chscan;
00045
00046 if(chscan=='c')
00047 {
00048 gotoxy(25,2);
00049 printf(" ");
00050 }
00051
00052 if(chscan=='o')
00053 {
00054 gotoxy(5,2);
00055 printf(" ");
00056 }
00057
00058 if(chscan=='e')
00059 {
00060 return 0;
00061 }
00062 switch(chscan)
00063 {
00064 case 'c':
00065 d1->isolutions=0;
00066 for(ii=0;ii<MAX_SIZE;ii++)
00067 {
00068 for(ik=0;ik<MAX_SIZE;ik++)
00069 {
00070 d1->iboard[ii][ik]=0;
00071 }
00072 }
00073 d1->tstart=clock();
00074
00075 if(d1->m1==manual)
00076 {
00077 chessboard(d1);
00078 }
00079
00080 calculate(d1,0);
00081 d1->tend=clock();
00082 d1->fcalctime=(float)(d1->tend-d1->tstart)/CLOCKS_PER_SEC;
00083 d1->iauthor=0;
00084 state(d1,6);
00085
00086 if(d1->m1==manual)
00087 {
00088 clrbox(0);
00089 clrbox(1);
00090 }
00091 break;
00092
00093 case 'o':
00094 options(d1);
00095 break;
00096 }
00097 return ichscan;
00098 }